﻿package com.ufenlei.LTS{
	public class TestingItem{
		public var id:int;
		public var question:String;
		public var optionList:Array;
		public var _status:int =0;
		public var type:String = "T";
		private var _key:int;
		public var answer:int;
		public var score:int;
		public static const STATUS_UNFINISHED:int = 0;
		public static const STATUS_FINISHED:int = 1;
		public static const TYPE_TEXT:String = "T";
		public static const TYPE_IMAGE:String = "P";
		public function TestingItem(id:int,  option_list:Array,optiontype:String, ikey:int, question:String = null,score:int = 0){
			this.id = id;
			this.score = score;
			type = optiontype;
			this._key = ikey;
			this.question = question;
			this.optionList = option_list;
		}
		public function setAnswer(a:int):void{
			this.answer = a;
			_status = STATUS_FINISHED;
		}
		public function check():Boolean{
			if(this.status >= STATUS_FINISHED){
				return this.answer == this.key;
			}else{
				return false;
			}
		}
		public function get key():int{
			return _key;
		}
		public function get status():int{
			return _status;
		}
		public function toString():String{
			return "id :\t\t "+this.id +"\nquestion : \t\t"+ this.question+"\noptionList : \t\t"+this.optionList;
		}
	}
}